// -----------------------------------------------------------------------
//  <copyright file="ServiceExtensions.cs" company="LiuliuSoft">
//      Copyright (c) 2022-2022 DaprPlus. All rights reserved.
//  </copyright>
//  <site>https://www.dapr.plus</site>
//  <last-editor>郭明锋</last-editor>
//  <last-date>2022-11-25 18:48</last-date>
// -----------------------------------------------------------------------


namespace DaprPlus.Dependency;

public static class ServiceExtensions
{
    /// <summary>
    /// 查找并注册所有自动注册的依赖注入服务
    /// </summary>
    public static IServiceCollection AddDependency(this IServiceCollection services, DaprPlusContext context)
    {
        var builder = services.GetOrAddSingletonInstance<IAutoDependencyBuilder>(() => new AutoDependencyBuilder(services));
        builder.Build(context);

        return services;
    }
}
